{include file="public/adminhead"}

<div class="container-fluid">

  <div class="row">
    <div class="card">
      <div class="card-body">

        <form class="form-horizontal" action="#" method="post" enctype="multipart/form-data" onsubmit="return false;">




          <div class="form-group">
            <label class="col-xs-12" >分组名称</label>
            <div class="col-xs-12">
              <input class="form-control" type="text" {if $res}value="{$res.name}"{/if} name="name" placeholder="..">
              <div class="help-block">如:编辑</div>
            </div>
          </div>


          <div class="form-group">
            <label class="col-xs-12" >排序值</label>
            <div class="col-xs-12">
              <input class="form-control" value="255" {if $res}value="{$res.ordid}"{/if} type="text" name="ordid" placeholder="默认255">
            </div>
          </div>

          <div class="form-group">
            <label class="col-xs-12" >说明</label>
            <div class="col-xs-12">
              <textarea class="form-control" name="remark" rows="6" placeholder="内容..">{if $res}{$res.remark}{/if} </textarea>
            </div>
          </div>

          <div class="form-group">
            <label class="col-xs-12">前台/后台</label>
            <div class="col-xs-12">
              <div class="radio">
                <label>
                  <input type="radio" name="admin" value="1"
                         {if $res}
                            {if $res.admin="=1"}checked="checked"{/if}
                        {else/}
                            checked="checked"
                        {/if}
                  >
                  后台
                </label>
              </div>
              <div class="radio">
                <label >
                  <input type="radio" name="admin" value="0" {if $res}{if $res.admin="=0"}checked="checked"{/if}{/if} >
                  前台
                </label>
              </div>
            </div>
          </div>

          <div class="form-group">
            <label class="col-xs-12">是否启用</label>
            <div class="col-xs-12">
              <div class="radio">
                <label>
                  <input type="radio" name="often" value="1"
                         {if $res}
                         {if $res.often="=1"}checked="checked"{/if}
                          {else/}
                          checked="checked"
                          {/if}

                  >
                  是
                </label>
              </div>
              <div class="radio">
                <label >
                  <input type="radio" name="often" value="0" {if $res}{if $res.often="=0"}checked="checked"{/if}{/if} >
                  否
                </label>
              </div>
            </div>
          </div>

          <div class="form-group">
            <div class="col-xs-12">
              <button class="btn btn-primary" type="button" onclick="sub()">提交</button>
            </div>
          </div>
        </form>

      </div>
    </div>
  </div>

</div>

{include file="public/afooter"}

<script>
function sub() {
    var formdata = $("form").serialize();
    var url = "{:url('AdminRbac/addgroup')}";
    $.post(url,formdata,function (e) {
      if(e.code == 200){
          success("成功");
          var index = parent.layer.getFrameIndex(window.name);
          setTimeout(function(){parent.layer.close(index)}, 2000);
          window.parent.location.reload();
      }else {
          error(e.msg);
      }
    })
}
</script>